package com.glsc.ngateway.common.xir.repo;


import com.glsc.ngateway.common.xir.domain.Tbnd;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface TbndRepository extends JpaRepository<Tbnd, String>, JpaSpecificationExecutor<Tbnd> {

    @Query(value = "select * from XIR_MD.TBND t where 1=1 " +
            "and (coalesce(:codeList, null) is null or t.I_CODE in (:codeList)) " +
            "and (coalesce(:pClassList, null) is null or t.P_CLASS in (:pClassList)) " +
            "", nativeQuery = true)
    List<Tbnd> findAllByPClassInAndICodeIn(@Param("codeList") List<String> codeList, @Param("pClassList") List<String> pClassList);
    @Query(value = "select * from XIR_MD.TBND t where 1=1 " +
            "and (coalesce(:codeList, null) is null or t.I_CODE in (:codeList)) " +
            "", nativeQuery = true)
    List<Tbnd> findAllByICodeIn(@Param("codeList") List<String> codeList);
}